package _Pan3D.program.shaders
{
	import _Pan3D.program.Shader3D;
	
	public class FensanShader extends Shader3D
	{
		public static var FENSAN_SHADER:String = "FENSAN_SHADER";
		public function FensanShader()
		{
			vertex = 
				"mov vt0, va0 \n"+
			    "add vt0.x,vt0.x,vc8.x \n"+
				
				"sin vt5.x,va2.z \n"+
				"cos vt5.y,va2.z \n"+
				
				"mov vt5.z,vt0.x \n"+
				"mul vt6.x,vt5.y,vt5.z \n"+
				"mul vt6.y,vt5.x,vt0.y \n"+
				"sub vt0.x,vt6.x,vt6.y \n"+
				
				"mul vt6.x,vt5.x,vt5.z \n"+
				"mul vt6.y,vt5.y,vt0.y \n"+
				"add vt0.y,vt6.x,vt6.y \n"+
				
				"sin vt5.x,va2.y \n"+
				"cos vt5.y,va2.y \n"+
				
				"mov vt5.z,vt0.x \n"+
				"mul vt6.x,vt5.y,vt5.z \n"+
				"mul vt6.y,vt5.x,vt0.z \n"+
				"sub vt0.x,vt6.x,vt6.y \n"+
				
				"mul vt6.x,vt5.x,vt5.z \n"+
				"mul vt6.y,vt5.y,vt0.z \n"+
				"add vt0.z,vt6.x,vt6.y \n"+
				
				//var tmp_rx = rx;
				//rx = cos_y * tmp_rx - sin_y * rz;
				//rz = sin_y * tmp_rx + cos_y * rz;
				//var tmp_ry = ry;
				//ry = cos_x * tmp_ry - sin_x * rz;
				//rz = sin_x * tmp_ry + cos_x * rz;
				
				"m44 vt0, vt0, vc4 \n" +
				"m44 vt0, vt0, vc0 \n" +
				"mov op, vt0 \n" +
				"mov v0, va1";
			fragment =
				"tex ft1, v0, fs0 <2d,clamp,repeat>\n"+
				"mov oc, ft1";
		}
	}
}